<?php
class Solution extends Model
{
	/**
	*
	* @var Puzzle
	*/
	private $puzzle;

	/**
	*
	* @var User
	*/
	private $user;

	/**
	*
	* @return Puzzle
	*/
	public function getPuzzle()
	{
		if(!$this->puzzle)
		{
			$this->puzzle = new Puzzle($this->puzzle_id);
		}	
		return $this->puzzle;
	}

	/**
	*
	* @return User
	*/
	public function getUser()
	{
		if(!$this->user)
		{
			$this->user = new User($this->user_id);
		}	
		return $this->user;
	}

	/**
	 * 
	 * @param array $where
	 * @param string $orderBy
	 * @param string $dir
	 * @param int $limit
	 * @return array
	 */
	public static function getAll($where = array(), $orderBy = null, $dir = 'ASC', $limit = 0)
	{
		return self::getAllModels(get_class(), $where, $orderBy, $dir, $limit);
	}
}